package com.nhjf.mobile.controller.organization;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nhjf.model.teachers.Teacher;
import com.nhjf.pojo.qo.teachers.TeachersQo;
import com.nhjf.service.system.OrganizationService;
import com.nhjf.service.teachers.OperationLogService;
import com.nhjf.service.teachers.TeachersService;

import net.sf.json.JSONObject;
@Controller
@RequestMapping("/organization")
public class organizationController {
	@Autowired
	private OrganizationService organizationService;
	@Autowired
	private TeachersService teachersService;
	
	//查看别人信息
	@ResponseBody
	@RequestMapping("/organizationDetail")
	public String myinformation(HttpServletRequest request, HttpServletResponse response,@RequestParam(value="teacherId", required=true)String  teacherId) {
		Map<String, Object> resMap=new HashMap<String, Object>();
		TeachersQo teachersQo=new TeachersQo();
		teachersQo.setSeachOrganization(true);
		teachersQo.setTeacherId(Long.parseLong(teacherId));
		Teacher teacher= teachersService.queryUnique(teachersQo);
		if(teacher!=null) {
			resMap.put("code", "200");
			resMap.put("message", teacher.getTraininginstitution());
			return JSONObject.fromObject(resMap).toString();
		}else {
			resMap.put("code", "500");
			resMap.put("message", "不存在此老师!");
			return JSONObject.fromObject(resMap).toString();
		}
		
	}
}
